name: pre-commit run_id: commands[0] env HOME: /home/jenkins env LANG: C.UTF-8 env PATH: /w/workspace/integration-test-tox-verify-master/.tox/pre-commit/bin:/opt/pyenv/bin:/tmp/venv-FS5o/bin:/opt/pyenv/shims:/home/jenkins/.local/bin:/opt/sdkman/candidates/mvnd/current/bin:/opt/sdkman/candidates/maven/current/bin:/opt/sdkman/candidates/java/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin env PIP_DISABLE_PIP_VERSION_CHECK: 1 env PIP_USER: 0 env PYTHONHASHSEED: 904168352 env PYTHONIOENCODING: utf-8 env SSH_AUTH_SOCK: ******************************** env TOX_ENV_DIR: /w/workspace/integration-test-tox-verify-master/.tox/pre-commit env TOX_ENV_NAME: pre-commit env TOX_WORK_DIR: /w/workspace/integration-test-tox-verify-master/.tox env VIRTUAL_ENV: /w/workspace/integration-test-tox-verify-master/.tox/pre-commit env __TOX_ENVIRONMENT_VARIABLE_ORIGINAL_CI: true metadata pid: 2589 cwd: /w/workspace/integration-test-tox-verify-master allow: /w/workspace/integration-test-tox-verify-master/.tox/pre-commit/bin/* cmd: pre-commit run --all-files --show-diff-on-failure exit_code: 1 [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. [WARNING] repo `https://github.com/pre-commit/pre-commit-hooks` uses deprecated stage names (commit, push) which will be removed in a future version. Hint: often `pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks` will fix this. if it does not -- consider reporting an issue to that repo. [INFO] Initializing environment for https://github.com/PyCQA/flake8. [INFO] Initializing environment for https://github.com/psf/black. [INFO] Initializing environment for https://github.com/MarketSquare/robotframework-tidy. [INFO] Initializing environment for https://github.com/MarketSquare/robotframework-tidy:robotframework==6.1.1. [INFO] Initializing environment for https://github.com/jorisroovers/gitlint. [INFO] Initializing environment for https://github.com/jorisroovers/gitlint:./gitlint-core[trusted-deps]. [INFO] Initializing environment for local:rstcheck,sphinx. [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/PyCQA/flake8. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/psf/black. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/MarketSquare/robotframework-tidy. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for local. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... trim trailing whitespace.................................................Passed flake8...................................................................Failed - hook id: flake8 - exit code: 1 tools/fastbgp/play.py:2682:28: W292 no newline at end of file threaded_job(arguments) ^ black....................................................................Failed - hook id: black - files were modified by this hook reformatted tools/fastbgp/play.py All done! ✨ 🍰 ✨ 1 file reformatted, 105 files left unchanged. robotidy.................................................................Passed rstcheck.................................................................Passed pre-commit hook(s) made changes. If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`. To run `pre-commit` as part of git workflow, use `pre-commit install`. All changes made by hooks: diff --git a/tools/fastbgp/play.py b/tools/fastbgp/play.py index 9839bafe..3735b2ca 100755 --- a/tools/fastbgp/play.py +++ b/tools/fastbgp/play.py @@ -181,7 +181,9 @@ def parse_arguments(): str_help = "Link-State NLRI supported" parser.add_argument("--bgpls", default=False, type=bool, help=str_help) str_help = "Link-State NLRI: Identifier" - parser.add_argument("-lsid", "--lsid", dest="lsid", default=1, type=int, help=str_help) + parser.add_argument( + "-lsid", "--lsid", dest="lsid", default=1, type=int, help=str_help + ) str_help = "Link-State NLRI: Policy Color" parser.add_argument( "--color", "-lstid", dest="color", default=100, type=int, help=str_help @@ -922,18 +924,16 @@ class MessageGenerator(object): """ if self.nlri_type == 6: identifier = self.base_identifier + int(index / self.lsid_step) - sid = ipaddr.IPv6Address(int(self.base_sid) + int(index / self.srv6_sid_step)) + sid = ipaddr.IPv6Address( + int(self.base_sid) + int(index / self.srv6_sid_step) + ) srv6_nlri_values = self.srv6_nlri_default.copy() srv6_nlri_values["Identifier"] = identifier srv6_nlri_values["SID"] = sid return srv6_nlri_values - identifier = self.ls_nlri_default["Identifier"] + int( - index / self.lsid_step - ) - color = self.ls_nlri_default["Color"] + int( - index / self.color_step - ) + identifier = self.ls_nlri_default["Identifier"] + int(index / self.lsid_step) + color = self.ls_nlri_default["Color"] + int(index / self.color_step) discriminator = self.ls_nlri_default["Discriminator"] + int( index / self.discriminator_step ) @@ -1141,151 +1141,72 @@ class MessageGenerator(object): optional_parameters_hex = b"" if self.rfc4760 or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x01" - b"\x00" - b"\x01" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x01" b"\x00" b"\x01" ) optional_parameters_hex += optional_parameter_hex if self.ipv6 or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x02" - b"\x00" - b"\x01" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x02" b"\x00" b"\x01" ) optional_parameters_hex += optional_parameter_hex if self.bgpls or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x40\x04" - b"\x00" - b"\x47" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x40\x04" b"\x00" b"\x47" ) optional_parameters_hex += optional_parameter_hex if self.evpn or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x19" - b"\x00" - b"\x46" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x19" b"\x00" b"\x46" ) optional_parameters_hex += optional_parameter_hex if self.mvpn or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x01" - b"\x00" - b"\x05" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x01" b"\x00" b"\x05" ) optional_parameters_hex += optional_parameter_hex optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x02" - b"\x00" - b"\x05" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x02" b"\x00" b"\x05" ) optional_parameters_hex += optional_parameter_hex if self.l3vpn_mcast or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x01" - b"\x00" - b"\x81" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x01" b"\x00" b"\x81" ) optional_parameters_hex += optional_parameter_hex optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x02" - b"\x00" - b"\x81" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x02" b"\x00" b"\x81" ) optional_parameters_hex += optional_parameter_hex if self.l3vpn or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x01" - b"\x00" - b"\x80" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x01" b"\x00" b"\x80" ) optional_parameters_hex += optional_parameter_hex optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x02" - b"\x00" - b"\x80" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x02" b"\x00" b"\x80" ) optional_parameters_hex += optional_parameter_hex if self.rt_constrain or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x01" - b"\x00" - b"\x84" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x01" b"\x00" b"\x84" ) optional_parameters_hex += optional_parameter_hex if self.bgplu or self.allf: optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x01" - b"\x04" - b"\x00\x01" - b"\x00" - b"\x04" + b"\x02" b"\x06" b"\x01" b"\x04" b"\x00\x01" b"\x00" b"\x04" ) optional_parameters_hex += optional_parameter_hex - optional_parameter_hex = ( - b"\x02" - b"\x06" - b"\x41" - b"\x04" - ) - optional_parameter_hex += struct.pack( - ">I", my_autonomous_system - ) + optional_parameter_hex = b"\x02" b"\x06" b"\x41" b"\x04" + optional_parameter_hex += struct.pack(">I", my_autonomous_system) optional_parameters_hex += optional_parameter_hex if self.grace != 8: @@ -1468,48 +1389,20 @@ class MessageGenerator(object): path_attributes_hex = b"" if not self.skipattr: - path_attributes_hex += ( - b"\x40" - b"\x01" - b"\x01" - b"\x00" - ) - path_attributes_hex += ( - b"\x40" - b"\x02" - b"\x06" - b"\x02" - b"\x01" - ) + path_attributes_hex += b"\x40" b"\x01" b"\x01" b"\x00" + path_attributes_hex += b"\x40" b"\x02" b"\x06" b"\x02" b"\x01" my_as_hex = struct.pack(">I", my_autonomous_system) path_attributes_hex += my_as_hex - path_attributes_hex += ( - b"\x40" - b"\x05" - b"\x04" - b"\x00\x00\x00\x64" - ) + path_attributes_hex += b"\x40" b"\x05" b"\x04" b"\x00\x00\x00\x64" if nlri_prefixes != []: - path_attributes_hex += ( - b"\x40" - b"\x03" - b"\x04" - ) + path_attributes_hex += b"\x40" b"\x03" b"\x04" next_hop_hex = struct.pack(">I", int(next_hop)) path_attributes_hex += next_hop_hex if originator_id is not None: - path_attributes_hex += ( - b"\x80" - b"\x09" - b"\x04" - ) + path_attributes_hex += b"\x80" b"\x09" b"\x04" path_attributes_hex += struct.pack(">I", int(originator_id)) if cluster_list_item is not None: - path_attributes_hex += ( - b"\x80" - b"\x0a" - b"\x04" - ) + path_attributes_hex += b"\x80" b"\x0a" b"\x04" path_attributes_hex += struct.pack(">I", int(cluster_list_item)) if self.bgpls and not end_of_rib: @@ -1554,17 +1447,12 @@ class MessageGenerator(object): mp_reach_content = ( b"\x40\x04" b"\x47" - b"\x04" - + struct.pack(">I", int(next_hop)) - + b"\x00" - + nlri + b"\x04" + struct.pack(">I", int(next_hop)) + b"\x00" + nlri ) path_attributes_hex += ( b"\x80" - b"\x0e" - + struct.pack("B", len(mp_reach_content)) - + mp_reach_content + b"\x0e" + struct.pack("B", len(mp_reach_content)) + mp_reach_content ) elif self.nlri_type == 6: @@ -1604,9 +1492,7 @@ class MessageGenerator(object): path_attributes_hex += ( b"\x80" - b"\x0e" - + struct.pack("B", len(mp_reach_content)) - + mp_reach_content + b"\x0e" + struct.pack("B", len(mp_reach_content)) + mp_reach_content ) # 5. BGP-LS Attribute (Attribute 29) @@ -1632,9 +1518,7 @@ class MessageGenerator(object): attr_29_content = tlv_1250 + tlv_1252 path_attributes_hex += ( b"\x80" - b"\x1d" - + struct.pack("B", len(attr_29_content)) - + attr_29_content + b"\x1d" + struct.pack("B", len(attr_29_content)) + attr_29_content ) total_path_attributes_length = len(path_attributes_hex) @@ -2679,4 +2563,4 @@ def threaded_job(arguments): if __name__ == "__main__": arguments = parse_arguments() logger = create_logger(arguments.loglevel, arguments.logfile) - threaded_job(arguments) \ No newline at end of file + threaded_job(arguments)